package com.treasure.service.commission.controller;

import com.treasure.service.annotation.LogInfo;
import com.treasure.service.commission.service.CommissionService;
import com.treasure.service.domain.TUserInfo;
import com.treasure.service.dto.TUserInfoDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
* @Description:    TODO 用户计算及相关查询
* @Author:         panxinwen
* @CreateDate:     2018/11/17 15:26
* @Version:        1.0
*/
@Api(value = "用户佣金",description = "用户佣金计算及查询")
@RestController
@RequestMapping("/commission/v1")
public class CommissionController {

    @Autowired
    private CommissionService commissionService;

    @LogInfo(log = "获取用户返佣统计数据")
    @PostMapping("/getStatistics")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户id", required = false, dataType = "Long", paramType = "query"),
    })
    public ResponseEntity  getStatistics(@RequestBody TUserInfo dto){

        Map<String,Object> map = commissionService.getStatistics(dto.getUserId());

        return ResponseEntity.ok(map);

    }

}
